package com.chaochis.springboottestdemo.controller;

import com.chaochis.springboottestdemo.base.ApiResult;
import com.chaochis.springboottestdemo.config.reqResConfig.dispatcherConfig.CustomRequestWrapper;
import com.chaochis.springboottestdemo.model.queryParam.LogParam;
import com.chaochis.springboottestdemo.model.queryParam.UserParam;
import com.chaochis.springboottestdemo.service.LogService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@RestController("test")
@RequestMapping("/test")
public class TestController {

  private final LogService logService;

  public TestController(LogService logService) {
    this.logService = logService;
  }

  @PostMapping("/testList")
  public ApiResult getUserList(@ApiIgnore CustomRequestWrapper customRequestWrapper, @RequestBody UserParam userParam){
    System.out.println(customRequestWrapper.getRequestInfo().getIp());
    return ApiResult.ok(this.logService.getAllList(new LogParam()));
  }
}
